/* 
 * Copyright [2017] [Alex/LiBo(libo2dev.aliyun.com/alex.link@foxmail.com)]
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hyts.sdkhttp.util;

/**  
 * @Title UploadUtils.java  
 * @Package com.hyts.http.util  
 * @Description 上传操作文件的操作帮助类  
 * @author LiBo/Alex  
 * @date 2018年4月11日  
 * @version V1.0  
 */
public class UploadUtils {

	/**  
	 * @Fields field:field:"--"  
	 */ 
	private static final String TOKEN_01 = "--";
	
	/**  
	 * @Fields field:field:"*****"
	 */ 
	private static final String TOKEN_02 = "---------------------------7e0dd540448";
	
	/**  
	 * @Fields field:field:"\r\n"  
	 */ 
	public static final String TOKEN_03 = "\r\n";

	/**  
	 * @Fields field:field:参数概要结构体
	 */ 
	private static final String CONTENT_DISPOSTION = "Content-Disposition: form-data; name=\"";
	
	
	/**  
	 * @Title: build  
	 * @Description: 构建开始状态传输信息
	 * @param @return    参数  
	 * @return String    返回类型  
	 * @throws  
	 */ 
	public static String buildStart() {
		return TOKEN_01+TOKEN_02+TOKEN_03;
	}
	
	/**  
	 * @Title: buildContentDispositionParam  
	 * @Description: 构建参数ContentDispostion  
	 * @param @param name
	 * @param @return    参数  
	 * @return String    返回类型  
	 * @throws  
	 */ 
	public static String buildContentDispositionParam(String name) {
		return CONTENT_DISPOSTION+name+"\"";
	}
		
	
	/**  
	 * @Title: buildContentDispositionFile  
	 * @Description: 构建文件ContentDispostion   
	 * @param @param fileParamKey
	 * @param @param fileNameValue
	 * @param @return    参数  
	 * @return String    返回类型  
	 * @throws  
	 */ 
	public static String buildContentDispositionFile(String fileParamKey,String fileNameValue) {
		return CONTENT_DISPOSTION+fileParamKey+"\";"+" filename=\""+fileNameValue+"\"";
	}
}
